package com.gc.server.vo.down;


import com.gc.server.entity.UserEntity;
import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;


import java.math.BigDecimal;

import com.gc.server.entity.TodoEntity;
import com.gc.server.vo.TodoVo;

import com.gc.server.enums.TodoTypeEnum;
import com.gc.server.enums.TodoStatusEnum;
import com.gc.server.enums.TodoAudioEnum;

/**
 * 日程实体
 * 表名 todo
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date ${datetime}
 */
@Data
public class TodoDown implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    //
    @ExcelProperty("")
    private Long id;

    //计划ID
    @ExcelProperty("计划ID")
    private Long planId;

    //时间
    @ExcelProperty("时间")
    private Date date;

    //ENUM-类型:"VISIT-药店拜访","SEND-试用装发放","ACT-促销活动"
    @ExcelIgnore
    private Integer type;
    @ExcelProperty("类型")
    private String typeStr;

    //主题
    @ExcelProperty("主题")
    private String title;

    //总评分
    @ExcelProperty("总评分")
    private BigDecimal score;

    //图片
    @ExcelProperty("图片评分")
    private BigDecimal imgScore;

    @ExcelProperty("逗留时间")
    private Long durHour;

    //定位信息
    @ExcelProperty("定位信息")
    private String address;

    //总结
    @ExcelProperty("总结")
    private String summary;

    //ENUM-状态:"TODO-未完成,WAIT-待审核","SCORE-已评分"
    @ExcelIgnore
    private Integer status;
    @ExcelProperty("状态")
    private String statusStr;

    //业务员ID
    @ExcelProperty("业务员ID")
    private Long userId;

    //IMG-价格维护照片
    @ExcelProperty("IMG-价格维护照片")
    private String priceImg;

    //IMG-陈列拍照
    @ExcelProperty("IMG-陈列拍照")
    private String displayImg;

    //IMG-气氛英文
    @ExcelProperty("IMG-气氛英文")
    private String airImg;

    //IMG-合照
    @ExcelProperty("IMG-合照")
    private String groupImg;

    //店员沟通
    @ExcelProperty("店员沟通")
    private String chat;

    //幼儿园名称
    @ExcelProperty("幼儿园名称")
    private String school;

    //ENUM-音频:"NO-没有","YES-有"
    @ExcelIgnore
    private Integer audio;
    @ExcelProperty("音频")
    private String audioStr;

    //发放数量
    @ExcelProperty("发放数量")
    private Integer sendNum;

    //IMG-发放图片
    @ExcelProperty("IMG-发放图片")
    private String sendImg;

    //活动名称
    @ExcelProperty("活动名称")
    private String actName;

    //销售数量
    @ExcelProperty("销售数量")
    private Integer sellNum;

    //新增会员数量
    @ExcelProperty("新增会员数量")
    private Integer userNum;

    //定位时间
    @ExcelProperty("定位时间")
    private Date addressTime;

    //提交时间
    @ExcelProperty("提交时间")
    private Date doneTime;

    //考核时间
    @ExcelProperty("考核时间")
    private Date scoreTime;

    //价格维护拍照时间
    @ExcelProperty("价格维护拍照时间")
    private Date priceTime;

    //陈列拍照时间
    @ExcelProperty("陈列拍照时间")
    private Date displayTime;

    //气氛拍照时间
    @ExcelProperty("气氛拍照时间")
    private Date airTime;

    //合照时间
    @ExcelProperty("合照时间")
    private Date groupTime;

    //发放时间
    @ExcelProperty("发放时间")
    private Date sendTime;

    //IMG-销售照片
    @ExcelProperty("IMG-销售照片")
    private String sellImg;

    //销售照片时间
    @ExcelProperty("销售照片时间")
    private Date sellTime;

    @ExcelProperty("用户名")
    private String userName;

    @ExcelProperty("用户编号")
    private String userCode;

    @ExcelProperty("用户级别")
    private Long levelId;

    public TodoDown() {

    }

    public TodoDown(TodoVo vo) {
        UserEntity user = vo.getUser();
        if(user!=null){
            this.setUserName(user.getName());
            this.setUserCode(user.getCode());
            this.setLevelId(user.getLevelId());
        }
        TodoEntity entity = vo.getEntity();
        this.setId(entity.getId());

        this.setPlanId(entity.getPlanId());

        this.setDate(entity.getDate());

        this.setType(entity.getType());
        if (entity.getType() != null) {
            this.setTypeStr(TodoTypeEnum.indexOf(entity.getType()));
        }

        this.setTitle(entity.getTitle());

        this.setScore(entity.getScore());

        this.setAddress(entity.getAddress());

        this.setSummary(entity.getSummary());

        this.setImgScore(entity.getImgScore());
        this.setDurHour(entity.getDurHour());

        this.setStatus(entity.getStatus());
        if (entity.getStatus() != null) {
            this.setStatusStr(TodoStatusEnum.indexOf(entity.getStatus()));
        }

        this.setUserId(entity.getUserId());

        this.setPriceImg(entity.getPriceImg());

        this.setDisplayImg(entity.getDisplayImg());

        this.setAirImg(entity.getAirImg());

        this.setGroupImg(entity.getGroupImg());

        this.setChat(entity.getChat());

        this.setSchool(entity.getSchool());

        this.setAudio(entity.getAudio());
        if (entity.getAudio() != null) {
            this.setAudioStr(TodoAudioEnum.indexOf(entity.getAudio()));
        }

        this.setSendNum(entity.getSendNum());

        this.setSendImg(entity.getSendImg());

        this.setActName(entity.getActName());

        this.setSellNum(entity.getSellNum());

        this.setUserNum(entity.getUserNum());

        this.setAddressTime(entity.getAddressTime());

        this.setDoneTime(entity.getDoneTime());

        this.setScoreTime(entity.getScoreTime());

        this.setPriceTime(entity.getPriceTime());

        this.setDisplayTime(entity.getDisplayTime());

        this.setAirTime(entity.getAirTime());

        this.setGroupTime(entity.getGroupTime());

        this.setSendTime(entity.getSendTime());

        this.setSellImg(entity.getSellImg());

        this.setSellTime(entity.getSellTime());

    }


}
